Skip to content

Trying to support octane#20

Draft
AlexzPurewoko wants to merge 10 commits into
masterfrom
improvements/octane-sandbox-enablement
Draft

Trying to support octane#20
AlexzPurewoko wants to merge 10 commits into
masterfrom
improvements/octane-sandbox-enablement

Conversation

@AlexzPurewoko

Copy link
Copy Markdown
Member

Next time ... (just dump)

AlexzPurewoko and others added 10 commits June 14, 2026 09:43
Add refactor-octane/ — a README index plus 7 agent-executable work docs
covering PLAN.md Phase 0 (runtime hygiene, static-state audit, feasibility
spike) and Phase 1 (bindShared fix, Application::__clone, re-point setters,
worker-safety) for the L42x clone-per-request Octane sandbox.

Each doc is self-contained with verified source anchors, an effort level,
the dependency DAG, new tests, and a full-suite-green acceptance gate.
Grounded against current source and adversarially rechecked for accuracy,
completeness, and minimal-change discipline. Scoped to the L42x side only;
the octane-rewrite-L42x package consumes what Phase 1 builds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
Change Container::bindShared to register the raw closure as a shared binding instead of wrapping it with share(), so cloned containers resolve their own shared instance cache while stock resolution behavior remains identical.

->share( audit verdict: zero request-scoped direct Container::share() call sites require conversion. View share() calls were excluded because they are Illuminate\View data-sharing APIs; vendored snapshots under package vendor directories were excluded as out of scope. Genuine direct container share() sites were classified APP-SCOPED and left unchanged: routing router/url/redirect providers, events dispatcher, exception handlers/whoops services, and mail symfony.transport registrations.

Baseline: make composer-test passed before the edit: Tests: 1619, Assertions: 3564, Skipped: 25.

Verification: ./execute-octane-sandbox ai:test tests/Container/ContainerBindSharedTest.php passed: 4 tests, 5 assertions. ./execute-octane-sandbox ai:test tests/Container/ContainerExtendTest.php tests/Container/ContainerL4Test.php passed: 9 tests, 16 assertions. make composer-test passed after the edit: Tests: 1623, Assertions: 3569, Skipped: 25.

Co-Authored-By: Codex <noreply@openai.com>
Add Application::__clone() to repoint only the app and Illuminate\Container\Container self-reference instances at the clone. The method does not deep-clone services, touch Container::tags, or perform facade/container static swaps.

Baseline: make composer-test passed before the edit: Tests: 1623, Assertions: 3569, Skipped: 25.

Verification: ./execute-octane-sandbox ai:test tests/Foundation/FoundationApplicationTest.php passed: 15 tests, 37 assertions. make composer-test passed after the edit: Tests: 1626, Assertions: 3575, Skipped: 25.

Co-Authored-By: Codex <noreply@openai.com>
Add dormant re-point APIs for the Octane clone-per-request worker: Support Manager setApplication()/forgetDrivers(), QueueManager setApplication()/forgetConnections(), DatabaseManager setApplication()/forgetConnections(), CookieJar flushQueuedCookies(), Router setContainer(), and Validation Factory setContainer().

The setters preserve app-lifetime registries and factories: Manager customCreators, QueueManager connectors, and DatabaseManager factory/extensions are not cleared. Optional view/engine code was skipped; Config Repository clone isolation is covered by a test without adding Repository::__clone().

Baseline: make composer-test passed before the edit: Tests: 1626, Assertions: 3575, Skipped: 25.

Verification: OctaneRepointSettersTest passed: 8 tests, 20 assertions. RoutingRouterOctaneSetContainerTest passed: 3 tests, 6 assertions. ConfigRepositoryCloneTest passed: 2 tests, 3 assertions. make composer-test passed after the edit: Tests: 1639, Assertions: 3604, Skipped: 25.

Dormancy spot-check: no src call sites for ->setApplication(), ->forgetDrivers(), ->forgetConnections(), or ->flushQueuedCookies(); router/validator setter searches found no new worker setter calls. Existing Validator::setContainer() usage is unchanged.

Co-Authored-By: Codex <noreply@openai.com>
Add Application::handleOctaneRequest() to drive the existing stacked kernel and return the response without send() or terminate(). Add the default-off instance  flag with runningInOctane()/setRunningInOctane(), and add Str::flushCache() for the process-global snake/camel/studly caches.

Decision record: chose handleOctaneRequest() over making getStackedClient() public because the worker package already probes this method and it encapsulates the stack/return-without-send contract. Chose an Application instance property over a bound 'octane' marker because it is copied by value into sandbox clones and requires no container lookup. No framework guard branch was added; the investigation found no justified request-path branch for this job.

Exit-neutralization findings: Application::handle(..., catch=false) rethrows before Exception\Handler::handleException(), so the worker's own try/catch owns normal request exceptions. Exception\Handler::handleException() returns a Response and contains no exit/die. Handler global hooks register handleUncaughtException() and handleShutdown(); those send a response on truly uncaught/fatal process paths but do not exit, and shutdown emission remains a worker/spike concern rather than a Job 13 framework edit. Request-path search found dd() in Support helpers as the concrete framework die; dd()/dump-style developer tooling legitimately terminates and is not guarded. ExceptionServiceProvider only configures Whoops not to exit. Foundation/start.php has a commented exit only. User/third-party exit/die remains outside framework control.

Worker-author notes: no Translator::flushParsedKeys() was added because translator is cloned into the sandbox, not reset in place. No D4 event shim was added because that belongs package-side. UrlGenerator uses the Laravel 4.2 forceSchema() spelling; forceScheme() is not an L42x API.

Baseline: make composer-test passed before the edit: Tests: 1639, Assertions: 3604, Skipped: 25.

Verification: FoundationApplicationTest passed: 18 tests, 49 assertions. SupportStrTest passed: 21 tests, 93 assertions. make composer-test passed after the edit: Tests: 1643, Assertions: 3622, Skipped: 25.

Co-Authored-By: Codex <noreply@openai.com>
Document the completed L42x Octane sandbox refactor jobs, committed changes, test verification, GO verdict meaning, and remaining package-side residual risks.

This commit stages only the new summary document; existing read-only/spike artifacts remain uncommitted per their original job specs.

Co-Authored-By: Codex <noreply@openai.com>
Clarify that PLAN Phase 1 maps to Jobs 10-13 already landed in L42x, and note that the D4 event-dispatch shim remains package-side by Job 13 scope.

Co-Authored-By: Codex <noreply@openai.com>
Document the repo-local PHP 8.3 Docker image/container names and common commands for running the test suite, targeted tests, shell, and feasibility spike.

Co-Authored-By: Codex <noreply@openai.com>
@AlexzPurewoko AlexzPurewoko self-assigned this Jun 15, 2026
@rizqyhi

rizqyhi commented Jun 19, 2026

Copy link
Copy Markdown
Member

@AlexzPurewoko kalau tertarik, coba explore Symfony Runtime, barangkali bisa lebih mudah ketimbang ngejar Octane.

@rizqyhi

rizqyhi commented Jun 19, 2026

Copy link
Copy Markdown
Member

@AlexzPurewoko ini juga menarik untuk mengetes apakah framework/app udah siap berjalan as worker atau belum https://github.com/igor-php/igor-php.

@AlexzPurewoko

AlexzPurewoko commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

Berdasarkan observasi awal. support atau tidaknya si worker mode ini, adalah global objects/singleton bang @rizqyhi

--> kalau dari laravel dan code dicoding sendiri mayoritas sudah menghindari adanya global state.
--> tapi ada beberapa kode dan kebiasaan yang perlu disesuaikan sih, misal di OauthClient atau apa itu

facades sendiri kan indirection, dia support.

Kode octane-nya disini : https://github.com/AlexzPurewoko/laravel-octane-l42x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants